/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package oop;

/**
 *
 * @author tandaica0612
 */
public class AmbiguityDecideMethodToCallOne {

    void test(Object s) {
        System.out.println("Object version");
    }

    void test(AmbiguityDecideMethodToCallOne s) {
        System.out.println("Tester version");
    }

    void test(SubTester s) {
        System.out.println("SubTester version");
    }
    class SubTester extends AmbiguityDecideMethodToCallOne {
    }

    public static void main(String[] args) {
        AmbiguityDecideMethodToCallOne c = new AmbiguityDecideMethodToCallOne();
        // Ambiguous, the most specific one which fit will be call
        c.test(null);         // SubTester version
        c.test(new Object()); // Object version
    }
}
/*
SubTester version
Object version
 * */